/**
 * Copyright &copy; 2012-2016 <a href="https://github.com/thinkgem/jeesite">JeeSite</a> All rights reserved.
 */
package com.thinkgem.jeesite.modules.acq.service.news;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.apache.commons.lang3.StringEscapeUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.thinkgem.jeesite.common.persistence.Page;
import com.thinkgem.jeesite.common.service.CrudService;
import com.thinkgem.jeesite.modules.acq.dao.news.AcqNewsDao;
import com.thinkgem.jeesite.modules.acq.entity.news.AcqNews;

/**
 * 系统消息Service
 * @author lj
 * @version 2018-06-28
 */
@Service
@Transactional(readOnly = true)
public class AcqNewsService extends CrudService<AcqNewsDao, AcqNews> {

	public AcqNews get(String id) {
		return super.get(id);
	}
	
	public List<AcqNews> findList(AcqNews acqNews) {
		return super.findList(acqNews);
	}
	
	public Page<AcqNews> findPage(Page<AcqNews> page, AcqNews acqNews) {
		return super.findPage(page, acqNews);
	}
	
	@Transactional(readOnly = false)
	public void save(AcqNews acqNews) {
		acqNews.setContent(StringEscapeUtils.unescapeHtml4(acqNews.getContent()));	
		super.save(acqNews);
	}
	
	@Transactional(readOnly = false)
	public void delete(AcqNews acqNews) {
		super.delete(acqNews);
	}
	@Transactional(readOnly = false)
	public Map<String,Object> news() {
		Map<String,Object> result = new HashMap<String, Object>();
		try{
			result.put("news",dao.news());
			result.put("message", "消息接口查询成功");
			result.put("success", true);
			return result;
		}catch(Exception e){
			e.printStackTrace();
			result.put("message", "消息接口查询失败");
			result.put("success",false);
			return result;
		}
		
	}
	
}